package com.yutian.selfservice.support;


import com.github.pagehelper.Page;
import com.yutian.selfservice.support.mapper.QuestionServiceMapper;

import com.yutian.selfservice.support.utils.PageSupport;
import com.yutian.selfservice.support.utils.Result;
import com.yutian.selfservice.support.utils.SpringUtil;
import lombok.Data;

import javax.persistence.Table;
import java.util.List;


@Data
@Table(name = "t_service_guide_question")
public class QuestionService extends ListService {
    private String question;
    private String answer;
    private Long serverId;
    private String relatedEventName;

    QuestionService(){
        super();
        super.type = 4l;
    }
//    @Override
//    public String getName() {
//        return this.question;
//    }

    @Override
    public Result query() {
        PageSupport.startPage(this);
        Page<QuestionService> list = (Page<QuestionService>) SpringUtil.getBean(QuestionServiceMapper.class).selectList(this);
        return Result.successPage(list);
    }

    @Override
    public List<? extends ListService> selectByIds(List<Long> ids) {
        return SpringUtil.getBean(QuestionServiceMapper.class).selectByIds(ids);
    }

    @Override
    public Result details() {
        return Result.success(SpringUtil.getBean(QuestionServiceMapper.class).selectByKey(this.getId()));
    }



}
